package com.example.designer.abstractfactory.factory;

import com.example.designer.abstractfactory.Color;
import com.example.designer.abstractfactory.Factory;
import com.example.designer.abstractfactory.impl.Purple;
import com.example.designer.abstractfactory.impl.Red;
import com.example.designer.abstractfactory.impl.Yellow;
import com.example.designer.factory.Car;
import com.example.designer.factory.impl.BaoMa;
import com.example.designer.factory.impl.BenChi;
import com.example.designer.factory.impl.DaZhon;

/**
 * 颜色工厂类
 */
public class ColorFactory implements Factory {
    @Override
    public Car getCar(String type) {
        return null;
    }

    @Override
    public Color getColor(String type) {
        if (type == null && type == ""){
            return null;
        }
        switch (type){
            case "RED":
                return new Red();
            case "YELLOW":
                return new Yellow();
            case "PURPLE":
                return new Purple();
            default:
                return null;
        }
    }
}
